package com.example.demonstrate.wang.utils;

import com.example.demonstrate.wang.entity.Profile;
import com.example.demonstrate.wang.entity.ProfileFace;
import com.example.demonstrate.wang.model.StandardFace;
import com.example.demonstrate.wang.model.StandardProfile;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author along
 * @Date 2024/6/27 16:52
 * @Description 业务档案和档案抓拍格式转换工具
 */
public class ConvertUtil {

    public static List<StandardProfile> convertToStandardProfiles(List<Profile> profileList) {
        List<StandardProfile> standardProfiles = new ArrayList<>();

        for (Profile profile : profileList) {
            StandardProfile standardProfile = new StandardProfile();
            standardProfile.setProfileId(profile.getProfileId());
            standardProfile.setSourceId("");
            standardProfile.setTargetId("");
            standardProfile.setCreateTime(profile.getCreatedTime());
            standardProfile.setFaceCount(profile.getFaceCount());
            standardProfile.setCoverPageImageUri(profile.getCoverPageImageUri());
            standardProfile.setReal(profile.getProfileType());
            standardProfile.setIdentityCard(profile.getCardId());
            standardProfiles.add(standardProfile);
        }
        return standardProfiles;
    }

    public static List<StandardFace> convertToStandardFaces(List<ProfileFace> profileFaceList) {
        List<StandardFace> standardFaces = new ArrayList<>();
        for (ProfileFace profileFace : profileFaceList) {
            StandardFace standardFace = new StandardFace();
            standardFace.setCaptureId(profileFace.getId());
            standardFace.setProfileId(profileFace.getProfileId());
            standardFace.setCropUri(profileFace.getCropUri());
            standardFace.setFullUri(profileFace.getFullUri());
            standardFace.setCapturedTime(profileFace.getCapturedTime());
            standardFace.setCameraName(profileFace.getCameraName());
            standardFace.setCameraId(profileFace.getCameraId());
            standardFace.setAppData(profileFace.getAppData());
            standardFaces.add(standardFace);
        }
        return standardFaces;
    }
}